<%@page import="java.sql.*"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" href="../css/clientTemplate.css">
        <title>Member List</title>
    </head>
    <body>
        <center>
        <table id="tableClientTemplate">
            <tr id="headerClientTemplate" style="background-color: orange">
                <td><%@include file="adminHeader.jsp" %></td>
            </tr>
            <tr id="middleClientTemplate">
                <td>

                     <table align="center">
            <tr>
                <th>User Name</th>
                <th>First Name</th>
                <th>Last Name</th>
                <th>Sex</th>
            </tr>
            <%
            try
                    {
            Connection con = helper.ConnectionHelper.GetConnection();
            String sql = "Select * from Users where UserName!='feedback' and UserName!='admin'";
            PreparedStatement p = con.prepareStatement(sql);
            ResultSet rs = p.executeQuery();
            String sex = "";
            while(rs.next())
                {
                    boolean ch = rs.getBoolean("Sex");
                    if(ch==true)
                        {
                            sex="Male";
                        }else
                            {
                                sex="Female";
                            }
        %>
        <form action="../ViewProfile" method="POST">
                <tr>
                    <td><input type="text" name="txtuser" readonly  value="<%=rs.getString("UserName")%>"/></td>
                    <td><input type="text" name="txtfname" readonly value="<%=rs.getString("FirstName")%>"/></td>
                    <td><input type="text" name="txtlname"  readonly value="<%=rs.getString("LastName")%>"/></td>
                    <td><input type="text" name="txtsex"  readonly value="<%=sex%>"/></td>
                    <td><input type="hidden" name="txtpass" readonly value="<%=rs.getString("Password")%>"/></td>
                    <td><input type="hidden" name="txtmin" readonly  value="<%=rs.getBoolean("IsAdmin")%>"/></td>
                    <td><input type="hidden" name="txtadd"  readonly value="<%=rs.getString("Address")%>"/></td>
                    <td><input type="hidden" name="txtrd"  readonly value="<%=rs.getString("RegisterDate")%>"/></td>
                    <td><input type="hidden" name="txtld"  readonly value="<%=rs.getString("LastActionDate")%>"/></td>
                    <td><input type="submit" value="View Profile" /></td>
                </tr>
            </form>
            <%}
            }catch(Exception e)
             {
                e.printStackTrace();
             }
             %>
        </table>

                </td>
            </tr>
            <tr id="footerClientTemplate">
                <td><%@include file="adminFooter.jsp" %></td>
            </tr>
        </table>
        </center>
    </body>
</html>
